// mock配置
export const MOCK_CONFIG = {
  ENABLED: import.meta.env.VITE_ENABLE_MOCK == 'true',
  APIFOX_URL: import.meta.env.VITE_APIFOX_BASE_URL,
  MOCK_PREFIX: '/api_apifox_proxy',
} as const

// API 相关常量
export const API_ENDPOINTS = {
  DASHBOARD: '/api/dashboard',
  CHART_DATA: '/api/chart/data',
  USER_INFO: '/api/user/info',
  SETTINGS: '/api/settings',
  WEATHER: MOCK_CONFIG.ENABLED ? MOCK_CONFIG.APIFOX_URL : '/api/weather',
} as const

// HTTP 状态码
export const HTTP_STATUS = {
  OK: 200,
  CREATED: 201,
  BAD_REQUEST: 400,
  UNAUTHORIZED: 401,
  FORBIDDEN: 403,
  NOT_FOUND: 404,
  INTERNAL_SERVER_ERROR: 500,
} as const

// 图表类型
export const CHART_TYPES = {
  BAR: 'bar',
  LINE: 'line',
  PIE: 'pie',
  AREA: 'area',
  SCATTER: 'scatter',
} as const

// 主题类型
export const THEME_TYPES = {
  LIGHT: 'light',
  DARK: 'dark',
} as const

// 日期范围选项
export const DATE_RANGES = {
  TODAY: 'today',
  YESTERDAY: 'yesterday',
  LAST_7_DAYS: 'last7days',
  LAST_30_DAYS: 'last30days',
  THIS_MONTH: 'thisMonth',
  LAST_MONTH: 'lastMonth',
  THIS_YEAR: 'thisYear',
} as const

// 菜单项键值
export const MENU_KEYS = {
  DASHBOARD: '1',
  CHARTS: '2',
  SETTINGS: '3',
  USER: '4',
} as const

// 图表颜色配置
export const CHART_COLORS = {
  PRIMARY: '#1890ff',
  SUCCESS: '#52c41a',
  WARNING: '#faad14',
  ERROR: '#f5222d',
  INFO: '#13c2c2',
  PURPLE: '#722ed1',
  ORANGE: '#fa8c16',
  PINK: '#eb2f96',
} as const

// 分页配置
export const PAGINATION = {
  DEFAULT_PAGE_SIZE: 10,
  PAGE_SIZE_OPTIONS: ['10', '20', '50', '100'],
  SHOW_SIZE_CHANGER: true,
  SHOW_QUICK_JUMPER: true,
} as const

// 本地存储键名
export const STORAGE_KEYS = {
  USER_TOKEN: 'user_token',
  USER_INFO: 'user_info',
  THEME: 'theme',
  LANGUAGE: 'language',
  SIDEBAR_COLLAPSED: 'sidebar_collapsed',
} as const

// 消息提示配置
export const MESSAGE_CONFIG = {
  DURATION: 3,
  MAX_COUNT: 3,
} as const

// 表单验证规则
export const VALIDATION_RULES = {
  REQUIRED: { required: true, message: '此字段为必填项' },
  EMAIL: {
    type: 'email' as const,
    message: '请输入有效的邮箱地址',
  },
  PHONE: {
    pattern: /^1[3-9]\d{9}$/,
    message: '请输入有效的手机号码',
  },
  PASSWORD: {
    min: 6,
    max: 20,
    message: '密码长度应在6-20位之间',
  },
} as const

// 文件上传配置
export const UPLOAD_CONFIG = {
  MAX_SIZE: 5 * 1024 * 1024, // 5MB
  ACCEPTED_TYPES: ['image/jpeg', 'image/png', 'image/gif'],
  MAX_COUNT: 5,
} as const

// 动画配置
export const ANIMATION = {
  DURATION: {
    FAST: 200,
    NORMAL: 300,
    SLOW: 500,
  },
  EASING: {
    EASE_IN: 'ease-in',
    EASE_OUT: 'ease-out',
    EASE_IN_OUT: 'ease-in-out',
  },
} as const

// 响应式断点
export const BREAKPOINTS = {
  XS: 480,
  SM: 576,
  MD: 768,
  LG: 992,
  XL: 1200,
  XXL: 1600,
} as const

// 默认配置
export const DEFAULT_CONFIG = {
  CHART: {
    HEIGHT: 400,
    ANIMATION: true,
    GRID: {
      LEFT: '3%',
      RIGHT: '4%',
      BOTTOM: '3%',
      CONTAIN_LABEL: true,
    },
  },
  TABLE: {
    PAGE_SIZE: 10,
    SCROLL_Y: 400,
  },
} as const

// 不需要token的接口列表
export const NO_TOKEN_URLS = [
  '/auth/login',
  '/auth/register',
  '/auth/refresh',
  '/public',
  '/captcha',
  API_ENDPOINTS.WEATHER,
] as const
